Repository navigation
Conversation
|
Claude finished @hudem1's task in 2m 3s —— View job PR review: native
|
| writer.WriteString("gas", Quantity(frame.Gas)); | ||
| WriteBytes(writer, create ? "init" : "input", frame.Input); | ||
| if (!create && frame.To is { } to) writer.WriteString("to", to.ToString()); | ||
| writer.WriteString("value", Quantity(frame.Value ?? UInt256.Zero)); |
There was a problem hiding this comment.
Medium: Geth parity, STATICCALL value
Geth's StaticCall calls captureBegin(..., STATICCALL, ..., nil), so callFrame.Value is nil. flatCallAction.Value is *big.Int with json:"value,omitempty", so Geth leaves value out of staticcall actions. NativeCallTracer already copies this: it sets Value = null for STATICCALL (NativeCallTracer.cs:153/464). The ?? UInt256.Zero here puts back "value":"0x0". Debug_traceCall_flatCallTracer_filters_and_renumbers_precompiles asserts that wrong value (rows[2]["action"]["value"] == "0x0" for the staticcall row).
| writer.WriteString("value", Quantity(frame.Value ?? UInt256.Zero)); | |
| if (frame.Value is { } value) writer.WriteString("value", Quantity(value)); |
Then update the test to expect no value on the staticcall row.
| "return data out of bounds" => "Out of bounds", | ||
| "stack limit reached 1024 (1023)" => "Out of stack", | ||
| "precompiled failed" or "invalid input length" => "Built-in failed", | ||
| _ when error.StartsWith("out of gas:", StringComparison.Ordinal) => "Out of gas", |
There was a problem hiding this comment.
Low: this mapping isn't in Geth. Geth's parityErrorMappingStartingWith has only invalid opcode: and stack underflow. Nethermind's error text out of gas: not enough gas for reentrancy sentry matches Geth's not enough gas for reentrancy sentry, which Geth does not convert. With convertParityErrors, Geth returns the raw text and this code returns Out of gas. If this is on purpose, add a short comment saying why; if not, remove the line.
| } | ||
| writer.WriteEndArray(); | ||
| } | ||
| using JsonDocument document = JsonDocument.Parse(buffer.WrittenMemory); |
There was a problem hiding this comment.
Low: perf. Each tx's output is built three times: written into an ArrayBufferWriter, parsed into a JsonDocument, then Clone()d into another buffer. With large block traces (thousands of frames per tx), this is noticeable overhead. One option: snapshot into a small typed frame list (or a byte[] plus a raw-JSON value holder) before disposing _inner, and let the serializer write it once. Also, Array.IndexOf(block.Transactions, tx) (line 45) runs once per tx, so block tracing is O(n²). The block tracer already knows the index, though passing it through would mean changing the factory signature, so this is optional.
Stateless guest cost
Variable cost by bucket, summed over shared blocks (excludes BASE)
Compared against |
|
Claude finished @hudem1's task in 33s —— View job PR review: native
|
Re-review: native
|
| Severity | Finding | Location |
|---|---|---|
| Medium | staticcall actions output "value":"0x0". Geth leaves value out, because it is nil with omitempty. ?? UInt256.Zero undoes the Value = null that NativeCallTracer already sets, and the precompile test asserts the wrong value. |
NativeFlatCallTracer.cs:150 (thread) |
| Low | The "out of gas:" prefix mapping is not in Geth's parityErrorMappingStartingWith, so the reentrancy-sentry error is converted here but not in Geth. |
:190 |
| Low | Perf: each tx's output goes through write, then JsonDocument.Parse, then Clone(). Array.IndexOf per tx makes block tracing O(n²). |
:116, :45 |
| Low | result field order is output, gasUsed; Geth's is gasUsed, output. This only matters for byte-level diffs. |
:162 |
No Critical/High or security issues found. The added XML docs are fine.
Not mergeable yet: the Medium Geth-parity finding needs a fix or an explicit reason it is intentional.
🤖 AI agent (Claude Code / Opus 5.5) review bot
svlachakis
left a comment
There was a problem hiding this comment.
The pinned reference supplies zero for nested STATICCALL values and maps the out of gas: prefix. The current output matches both. Low - GethStyleTracer.std.cs:77: setting IsTraceCall here adds a record allocation to every debug_traceCall. Set it in the options copies already made for indexed and non-indexed calls.
Changes
flatCallTracerfor NAT-01 by composing the existingNativeCallTracer, rather than importing the old stacked block-tracer implementation from Support Geth flatCallTracer and precise invalid-opcode diagnostics #14099 or duplicating VM tracing.traceAddress/subtraces, per-transaction block/hash/index metadata, and zero/null syntheticdebug_traceCallmetadata (including indexed calls and block overrides).includePrecompilesandconvertParityErrors(both false by default); match Geth's canonical fork-precompile filtering, filtered sibling numbering, revert output and exceptional-result omission. Unrelated/unknown config fields remain ignored as in Geth.callTracer/VM behavior. Support Geth flatCallTracer and precise invalid-opcode diagnostics #14099's invalid-opcode subfix was already superseded by Preserve opcode identity in native call tracer errors #15836; it is not redone here. Support Geth flatCallTracer and precise invalid-opcode diagnostics #14099 remains open and unchanged while this focused replacement is reviewed.Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Tested commit
d34d6f50c013a588a88209b6dd36466a5fdf75fe, based on masterf296f39d245375d0273d77224380606e58e130c8, .NET 11.0.100, parent-only serial compilation/testing:flatCallTraceras an unregistered JavaScript expression and unconditionally cast its block tracer to IDisposable. Keep the original deferred-JavaScript guarantee using a genuinely unregistered selector; native selection is independently asserted. An unused-import analyzer warning and a parent import-cleanup compile mistake were also retained and corrected; assertions were not weakened.Reproduce targeted gates:
Master advanced after local validation to
14d42a1fef588929a50b6b359d531793006acf83(41 commits, no direct overlap with these ten changed files). The local results above are not claimed for a merged tree with that newer master. Fresh CI/integration review remains required; no merge or auto-merge is requested.Documentation
Requires documentation update
Requires explanation in Release Notes
Adds native Geth-style
flatCallTracerselection through debug tracing, withincludePrecompilesandconvertParityErrorsconfiguration. It returns flat call/create/selfdestruct entries rather than the nestedcallTracertree.Remarks
bbafd66b66f5e37e877bf1efe3506ad74a6eda98/eth/tracers/native/call_flat.go, including generated JSON serializers and error mapping; audited00821e33baseline inspected too. Local reference fixtures were inspected, not executed. No full paired-client Geth run or performance improvement is claimed.debug_traceCall, native streaming and mux. Simulation/traceCallMany-specific flat metadata is not advertised as validated Geth parity. Frame types absent from the pinned flat schema (e.g. newer TCREATE) are rejected rather than silently rendered as CALL.txHashfiltering per Hugo/Lukasz's explicit policy, permissive durations, and the one-space JS callback diagnostic policy.Ready for review at the owner’s request. 🤖 AI agent (Pi / gpt-6.1-sol), implementing and validating on behalf of @hudem1.